package inputStream;

import java.io.FileInputStream;
import java.io.FileNotFoundException;
import java.io.FileOutputStream;
import java.io.IOException;

public class InputStream {

	public static void main(String[] args) {
		FileInputStream fis = null;
		try {
			// 创建输入流对象（FileInputStream对象）
			fis = new FileInputStream("e:/t01/hello.txt");
			// 读取文本文件（read()）
			int len = fis.available();
			System.out.println("文件可读取的字节数是：" + len);
			int data;
			while ((data = fis.read()) != -1){
				System.out.print((char)data);
			}	
		} catch (FileNotFoundException e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		} catch (IOException e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		}finally{
			try {
				// 关闭流
				fis.close();
			} catch (IOException e) {
				// TODO Auto-generated catch block
				e.printStackTrace();
			}
		}
	}
}
